﻿
using Business.Base.Common;
using Business.Base.Enums;
using Pumptester.Common;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Pumptester
{
    public partial class ChooseForm : Form
    {

        private String pumpTypeName;
        private ExperimentType experimentType;
        private String experimentTypeName;
        private EntryForm entryForm;


        //public int PumpType { get => pumpType; set => pumpType = value; }
        public string PumpTypeName { get => pumpTypeName; set => pumpTypeName = value; }
        public ExperimentType ExperimentType { get => experimentType; set => experimentType = value; }
        public string ExperimentTypeName { get => experimentTypeName; set => experimentTypeName = value; }
        public EntryForm EntryForm { get => entryForm; set => entryForm = value; }
        FormMoveAction action;
        public ChooseForm()
        {

            InitializeComponent();
        }

        public ChooseForm(EntryForm form)
        {
            this.entryForm = form;
            this.entryForm.Hide();
            InitializeComponent();
        }

        private void ChooseForm_Load(object sender, EventArgs e)
        {
            //comboBoxPumpType.DataSource = Config.PumpTypes;
            //comboBoxPumpType.DisplayMember = "BindMember";
            //comboBoxPumpType.ValueMember = "BindValue";
            //comboBoxPumpType.SelectedIndex = 0;

            comboBoxExperimentType.DataSource = DataSource.DataSourceDic[DataSource.EXPERIMENT_TYPE_DATASOURCE];
            comboBoxExperimentType.DisplayMember = "BindMember";
            comboBoxExperimentType.ValueMember = "BindValue";
            comboBoxExperimentType.SelectedIndex = 0;

            action = new FormMoveAction(this);
        }

        private void buttonOK_Click(object sender, EventArgs e)
        {  
           
            this.ExperimentType = (ExperimentType)this.comboBoxExperimentType.SelectedValue;          
            this.ExperimentTypeName = this.ExperimentType.ToString();

            this.DialogResult = DialogResult.OK;
            this.Close();
        }

        private void buttonCancle_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
            this.entryForm.Show();
            this.Close();
            
        }
    }
}
